package com.synnex.mobile.servier.core.actRecord.bo;

import com.synnex.mobile.generic.core.util.ObjectUtil;
import com.synnex.mobile.servier.core.actRecord.dto.ActivityRecord;
import com.synnex.mobile.servier.core.actRecord.dto.Folder;
import com.synnex.mobile.servier.web.utils.DateUtil;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: kerryf
 * Date: 13-8-9
 * To change this template use File | Settings | File Templates.
 */
public class FolderBo {

    private Integer id;
    private String title;
    private String date;
    private Integer seq;
    private String category;
    private Date ddate;

    private Date entryDate;
    private Date updateDate;


    public Integer getSeq() {
        return seq;
    }

    public void setSeq(Integer seq) {
        this.seq = seq;
    }

    public Date getEntryDate() {
        return entryDate;
    }

    public void setEntryDate(Date entryDate) {
        this.entryDate = entryDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDate() {
        return date;
    }

    public Date getDdate() {
        return ddate;
    }

    public void setDdate(Date ddate) {
        this.ddate = ddate;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public static FolderBo createInstance(Folder folder){
        FolderBo fb = new FolderBo();
        if(folder!=null){
            fb =  ObjectUtil.copyProperties(folder, FolderBo.class);
            fb.setDdate(DateUtil.strToDate(fb.getDate()));
        }else{
//            return new FolderBo();
        }
        return fb;
    }

    public static List<FolderBo> createInstance(List<Folder> folders){

        List<FolderBo> folderBos = new ArrayList<FolderBo>();
        if (folders != null) {
            for (Folder data : folders) {
                folderBos.add(createInstance(data));
            }
        }
        return folderBos;
    }
}
